lib/commit: Check that dirent is a directory before cleaning
authorJonathan Lebon <jonathan@jlebon.com>
Fri, 17 Apr 2020 18:29:13 +0000 (14:29 -0400)
committerJonathan Lebon <jonathan@jlebon.com>
Fri, 17 Apr 2020 18:29:13 +0000 (14:29 -0400)
commit8ece36c28a3449de9dce9d43252aeb0ffc166687
tree76c740b93b8a21a240a0a193ccb733241f4e184c
parentdf065ad766c325bac2fa9a83ea1af7e1616abe16
lib/commit: Check that dirent is a directory before cleaning

I've only noticed this by inspection. But I think it's possible for
`cleanup_txn_dir` to get called with the `staging-...-lock` file since
it matches the prefix.

Make the checking here stronger by verifying that it's a directory. If
it's not a directory (lockfile), then follow the default pruning expiry
logic so that we still cleanup stray lockfiles eventually.
src/libostree/ostree-repo-commit.c